package com.mtung.dubbo.loadbalance.impl;

import com.mtung.dubbo.loadbalance.LoadBalance;

import java.util.List;

/**
 * 循环调用
 * @author : zhenguo.yao
 * @date : 2020/3/23 0023 13:48
 */
public class LoopLoadBalance implements LoadBalance {

    private int index = 0;
    public synchronized String select(List<String> repos) {

        if (index >= repos.size()) {
            index = 0;
        }
        String value = repos.get(index++);
        System.out.println("value:" + value);
        return value;
    }
}
